package com.example.mall.service.impl;

import com.example.mall.dao.OrderDAO;
import com.example.mall.entity.Order;
import com.example.mall.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class OrderServiceImpl implements OrderService {
    private OrderDAO orderDAO;

    @Autowired
    public OrderServiceImpl(OrderDAO orderDAO) {
        this.orderDAO = orderDAO;
    }

    @Override
    public List<Order> selectAll() {
        return orderDAO.selectAll();
    }

    @Override
    public int save(Order order) {
        return orderDAO.save(order);
        // System.out.println(1/0); // 手动报错,事务生效
    }

    @Override
    public void update(Order tbOrder) {

    }
}
